#include <textManipulation.h>


bool makeChange(QString* string, Change* change)
{
    if(change->type == INSERT)
    {
        string->insert(change->beginInSrc, change->value);
        return true;
    }
    else if(change->type == DELETE)
    {
        string->remove(change->beginInSrc, change->endInSrc - change->beginInSrc);
        return true;
    }
    else
        return false;

}

bool unmakeChange(QString* string, Change* change)
{
    if(change->type == INSERT)
    {
        string->remove(change->beginInSrc, change->endInSrc - change->beginInSrc);
        return true;
    }
    else if(change->type == DELETE)
    {
        string->insert(change->beginInSrc, change->value);
        return true;
    }
    else
        return false;

}
